<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.meichaoit.dao.AccountDao"%>
<%@page import="com.meichaoit.entity.Account"%>


<%

	request.setCharacterEncoding("UTF-8");
	
	String name = request.getParameter("username");
	String pwd = request.getParameter("password");
	
	AccountDao dao =new  AccountDao();
	Account account=dao.login(name,pwd);
	if(account==null){
		response.sendRedirect("login.jsp?code=03");
	}else{
		//伴随着整个会话周期
		session.setAttribute("account",account);
		
		response.sendRedirect("main.jsp");
		//request.setAttribute("name",name);
		//RequestDispatcher rd = request.getRequestDispatcher("main.jsp");
		//rd.forward(request,response);
	}
%>